package com.xbenben.project.common.filter;

import com.xbenben.project.common.annotate.ReqLog;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;

import java.lang.reflect.Method;

/**
 * @author yu.zhijia
 * Date:2023/3/20 11:47
 **/
@Aspect
@Component
@Slf4j
public class LogPointCut {

    /**
     * 监听 日志注解
     */
    @Around("@annotation(com.xbenben.project.common.annotate.ReqLog)")
    public Object soutLog(ProceedingJoinPoint proceed) throws Throwable {
        Method method = ((MethodSignature) proceed.getSignature()).getMethod();
        ReqLog annotation = method.getAnnotation(ReqLog.class);
        if (annotation != null) {
        }
        return proceed.proceed();
    }

}
